package hnlg.com.cn.purviewmanage.rolemanage.junit;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import hnlg.com.cn.model.RoleVO;
import hnlg.com.cn.purviewmanage.rolemanage.service.IRoleService;


@SpringBootTest
@RunWith(SpringRunner.class)
public class IRoleServiceImplTest {

	@Resource IRoleService RoleService;
	@Test
	public void testQueryList() throws Exception {
		RoleVO vo=new RoleVO();
		RoleService.queryList(vo);
	}

	@Test
	public void testAddRole() throws Exception {
		RoleVO vo=new RoleVO();
		vo.setRolename("普通用户");
		vo.setRemark("管理员");
		RoleService.addRole(vo);
	}

	@Test
	public void testUpdateRole() throws Exception {
		RoleVO vo=new RoleVO();
		vo.setRolename("系统角色");
		vo.setRemark("管理员");
		vo.setRoleid(3);
		RoleService.updateRole(vo);
	}

	@Test
	public void testDeleteRole() throws Exception {
		RoleService.deleteRole("3");
	}

	@Test
	public void testRoleaddModule()throws Exception{
		try{
		  String roleid="1";
		  String moduleid[]={"1","2"};
		  RoleService.roleaddModule(roleid, moduleid);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	@Test
	public void testQueryRoleModuleList()throws Exception{
		try{
			String roleid="2";
			List list=RoleService.queryModuleIdList(roleid);
			System.out.println("list="+list);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
